package com.orifine.orm.type;

import java.sql.Date;
import java.text.SimpleDateFormat;

import com.orifine.orm.Information;
import com.orifine.orm.Type;
import com.orifine.orm.information.DateIncrementInfo;
import com.orifine.orm.model.ColumnModel;

public class DateType extends Type {
	private Date value;
	private static final SimpleDateFormat format = new SimpleDateFormat("yyyy-M-dd");
	
	public DateType(){
		value = new Date(System.currentTimeMillis());
	}
	
	public DateType(Date date){
		this.value = date;
	}
	
	@Override
	public String getScriptType(ColumnModel column) {
		return "DATE";
	}

	@Override
	public String getScriptValue(ColumnModel columnt) {
		return filterQuote(format.format(value));
	}

	@Override
	public Information getDefaultInfo(ColumnModel column) {
		return new DateIncrementInfo();
	}
}
